/**
 * 其它入库(委外订单入库)
 */
import request from '@/utils/httpRequest.js';
import axiosRequest from "@/utils/axiosRequest.js";


//分页查询其它订单(委外)列表信息
export function reqSubcontractOrderList(parameter){
    return request({
        url:"/wmsOutsourcingIn/list",
        method:"post",
        data:{
            page:parameter.page,
            size:parameter.size,
            subcontractOrderNumber:parameter.purchaseCode,
            customFieldOne:parameter.customFieldOne
        }
    })
}

//查询其它（委外）订单详情
export function reqSubcontractOrderDetail(orderNum){
    return request({
        url:"/wmsOutsourcingIn/detail",
        method:"get",
        params:{
            subcontractOrderNumber:orderNum
        }
    })
}

//供应商列表信息
export function reqPurchaseSuppliers(){
    return request({
        url:"/wmsOutsourcingIn/suppliers/list",
        method:"get",
        params:{
            page:1,
            size:100,
            code:"",
            name:""
        }
    })
}

//获取当前申请人
export function reqCurrentPerson(){
    return request({
        url:"/api/users/current",
        method:"get"
    })
}

//获取申请人列表信息
export function reqUserList(){
    return request({
        url:"/api/users/list",
        method:"get",
        params:{
            page:1,
            size:100,
            nickname:""
        }
    })
}

//获取默认其它入库单号
export function reqDefaultOutsourcingInCode(){
    return request({
        url:"/wmsOutsourcingIn/seCode",
        method:"get"
    })
}


//获取仓库列表信息
export function reqWarehouseList(){
    return request({
        url:"/wmsOutsourcingIn/warehouse/all",
        method:"get"
    })
}
//获取其它订单状态数量
export function reqOutsourcingStatusNum(){
    return request({
        url:"/wmsOutsourcingIn/menu/num",
        method:"get"
    })
}
//获取入库单列表
export function reqOutsourcingInList(parameter){
    return request({
        url:"/wmsOutsourcingIn/in/list",
        method:"post",
        data:parameter
    })
}

//获取入库单详情
export function reqOutsourcingInDetail(purchaseId){
    return request({
        url:"/wmsOutsourcingIn/in/detail",
        method:"get",
        params:{
            id:purchaseId
        }
    })
}

//创建并完成其它入库单
export function reqCreateOutsourcingIn(parameter){
    return request({
        url:"/wmsOutsourcingIn/in/create",
        method:"post",
        data:parameter
    })
}
//创建其它入库单
export function reqCreateOutsourcingOrder(parameter){
    return request({
        url:"/wmsOutsourcingIn/create",
        method:"post",
        data:parameter
    })
}
//更新其它入库单
export function reqUpdateOutsourcingOrder(parameter){
    return request({
        url:"/wmsOutsourcingIn/update",
        method:"post",
        data:parameter
    })
}

//获取平台编码解析规则
export const reqScanCodeRuleInfo = (flagCode) => {
    if(!flagCode){
        flagCode = 'purchaseWarehousing.handleBarcodeScan.new';
    }
    return axiosRequest({
        url:"/wms/stocks/scan/code/rule/get",
        method:"post",
        data:{
            code:flagCode
        }
    })
}

//根据委外订单单号物料号获取批次号
export const reqBarcode = (relateNumber,materialCode) => {
    return request({
        url:"/wmsOutsourcingIn/barcode",
        method:"get",
        params:{
            relateNumber,
            materialCode
        }
    })
}

//获取标签模板接口
export const reqLabelTypes = () => {
    return request({
        url:"/labelTypes/rulesDetail2",
        method:"get",
        params:{
            ruleCode:'purchaseMaterialbarCode'
        }
    })
}

export const reqPrintLabelType = (parameter) => {
    return request({
        url:"/labelTypes/printLabel",
        method:"post",
        data:parameter
    })
}
